﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ENG.EngStartQueueLib
{
  [Serializable()]
  public class ExecInfo : Reference
  {
    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)]
    private System.Diagnostics.ProcessPriorityClass _Priority = System.Diagnostics.ProcessPriorityClass.Normal;
    ///<summary>
    /// Sets/gets Priority value.
    ///</summary>
    public System.Diagnostics.ProcessPriorityClass Priority
    {
      get
      {
        return (_Priority);
      }
      set
      {
        _Priority = value;
      }
    }

    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)]
    private decimal _ExplicitDelay = 0;
    ///<summary>
    /// Sets/gets ExplicitDelay value.
    ///</summary>
    public decimal ExplicitDelay
    {
      get
      {
        return (_ExplicitDelay);
      }
      set
      {
        _ExplicitDelay = value;
      }
    }

    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)]
    private bool _IsActive = true;
    ///<summary>
    /// Sets/gets IsActive value.
    ///</summary>
    public bool IsActive
    {
      get
      {
        return (_IsActive);
      }
      set
      {
        _IsActive = value;
      }
    }

    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)]
    private string _Source;
    ///<summary>
    /// Sets/gets Source value.
    ///</summary>
    public override string Source
    {
      get
      {
        return (_Source);
      }      
    }

    public void ExplicitlySetSource(string source)
    {
      this._Source = source;
    }

    public ExecInfo(LinkReference link)
    {
      this.Arguments = link.Arguments;
      this.ExplicitDelay = 0;
      this.FileName = link.FileName;
      this.IsActive = true;
      this.Path = link.Path;
      this.Priority = System.Diagnostics.ProcessPriorityClass.Normal;
      this._Source = link.Source;
      this.WindowStyle = link.WindowStyle;
      this.WorkingDirectory = link.WorkingDirectory;
    }
    public ExecInfo(RegistryReference link)
    {
      this.Arguments = link.Arguments;
      this.ExplicitDelay = 0;
      this.FileName = link.FileName;
      this.IsActive = true;
      this.Path = link.Path;
      this.Priority = System.Diagnostics.ProcessPriorityClass.Normal;
      this._Source = link.Source;
      this.WindowStyle = link.WindowStyle;
      this.WorkingDirectory = link.WorkingDirectory;
    }
    public ExecInfo()
    {
      this.Arguments = "";
      this.ExplicitDelay = 0;
      this.FileName = "";
      this.IsActive = true;
      this.Path = "";
      this.Priority = System.Diagnostics.ProcessPriorityClass.Normal;
      this._Source = null;
      this.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
      this.WorkingDirectory = "";
    }
  }
}
